var HighlightProfile = function()
{
	$$('a').each(function(link)
			{
				if (link && link.href && link.href == "http://www.blogger.com/profile/04884903526025424234" && link.innerHTML && link.innerHTML == ".crypto")
				{
					link.addClass('post-title-link');
				}
			}
		);
}



window.addEvent('domready', function()
{	
	HighlightProfile();
	
	dp.SyntaxHighlighter.ClipboardSwf = 'http://misbug.googlecode.com/svn/trunk/dp.SyntaxHighlighter/Scripts/clipboard.swf';
	dp.SyntaxHighlighter.HighlightAll('code');

	
	Misbug.DOM.GetChildNodesByClassName(document.body, 'tab-panel', 'div', true).each(function(element)
	{
		new Misbug.UI.TabPanel({
			id: element.id
		});
	});
	
	Misbug.DOM.GetChildNodesByClassName(document.body, 'scroller', 'div', true).each(function(element)
	{
		new Misbug.UI.Scroller({
			container: element
		});
	});
	
	$$('.bg').each(function(element)
	{
		element.setOpacity('0.1')
	});
		
	
//	alert(document.getElementById('external_links-kwick-shared_items'));
	
	var szNormal = [
		420,
		180,
		400,
		200,
		380,
		220
	];
	
	var szSmall = [
		szNormal[1] - 50,
		szNormal[0] - 50,
		szNormal[3] - 50,
		szNormal[2] - 10,
		szNormal[5] - 180,
		szNormal[4] - 5
	];
	
	var szFull = [
		szNormal[0] + 50,
		szNormal[1] + 50,
		szNormal[2] + 50,
		szNormal[3] + 10,
		szNormal[4] + 180,
		szNormal[5] + 5
	];
	
	$('navigation-kwick-archive').setStyle('width',				szNormal[0] + 'px');
	$('navigation-kwick-labels').setStyle('width',				szNormal[1] + 'px');
	$('external_links-kwick-shared_items').setStyle('width',	szNormal[2] + 'px');
	$('external_links-kwick-links').setStyle('width',			szNormal[3] + 'px');
	$('profile-kwick-data').setStyle('width',					szNormal[4] + 'px');
	$('profile-kwick-photos').setStyle('width',					szNormal[5] + 'px');
	
	
	var navigationKwicks = $$('#navigation-kwicks .kwick');
	
	var navigationFx = new Fx.Elements(navigationKwicks, {wait: false, duration: 500, transition: Fx.Transitions.Back.easeOut});
	navigationKwicks.each(function(kwick, i)
	{
		kwick.addEvent("mouseenter", function(event)
		{
			var o = {};
			o[i] = {width: [kwick.getStyle("width").toInt(), szFull[i]]}
			navigationKwicks.each(function(other, j)
			{
				if (i != j)
				{
					var w = other.getStyle("width").toInt();
					if (w != szSmall[i])
					{
						o[j] = {width: [w, szSmall[i]]};
					}
				}
			});
			navigationFx.start(o);
		});
	});
	 
	$("navigation-kwicks").addEvent("mouseleave", function(event)
	{
		var o = {};
		navigationKwicks.each(function(kwick, i)
		{
			o[i] = {width: [kwick.getStyle("width").toInt(), szNormal[i]]}
		});
		navigationFx.start(o);
	});

		 
	var externalLlinksKwicks = $$('#external_links-kwicks .kwick');
	
	var externalLlinksFx = new Fx.Elements(externalLlinksKwicks, {wait: false, duration: 500, transition: Fx.Transitions.Back.easeOut});
	externalLlinksKwicks.each(function(kwick, i)
	{
		kwick.addEvent("mouseenter", function(event)
		{
			var o = {};
			o[i] = {width: [kwick.getStyle("width").toInt(), szFull[i + 2]]}
			externalLlinksKwicks.each(function(other, j)
			{
				if (i != j)
				{
					var w = other.getStyle("width").toInt();
					if (w != szSmall[i + 2])
					{
						o[j] = {width: [w, szSmall[i + 2]]};
					}
				}
			});
			externalLlinksFx.start(o);
		});
	});
	 
	$("external_links-kwicks").addEvent("mouseleave", function(event)
	{
		var o = {};
		externalLlinksKwicks.each(function(kwick, i)
		{
			o[i] = {width: [kwick.getStyle("width").toInt(), szNormal[i + 2]]}
		});
		externalLlinksFx.start(o);
	});
	
	
	 
	var profileKwicks = $$('#profile-kwicks .kwick');
	
	var profileFx = new Fx.Elements(profileKwicks, {wait: false, duration: 500, transition: Fx.Transitions.Back.easeOut});
	profileKwicks.each(function(kwick, i)
	{
		kwick.addEvent("mouseenter", function(event)
		{
			var o = {};
			o[i] = {width: [kwick.getStyle("width").toInt(), szFull[i + 4]]}
			profileKwicks.each(function(other, j)
			{
				if (i != j)
				{
					var w = other.getStyle("width").toInt();
					if (w != szSmall[i + 4])
					{
						o[j] = {width: [w, szSmall[i + 4]]};
					}
				}
			});
			profileFx.start(o);
		});
	});
	 
	$("profile-kwicks").addEvent("mouseleave", function(event)
	{
		var o = {};
		profileKwicks.each(function(kwick, i)
		{
			o[i] = {width: [kwick.getStyle("width").toInt(), szNormal[i + 4]]}
		});
		profileFx.start(o);
	});



});

